package com.reny.ll.git.mvvm

import android.annotation.SuppressLint
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
import com.reny.ll.git.core.App

class NetUtils {

    companion object{

        @SuppressLint("MissingPermission")
        fun isConn(context: Context = App.instance):Boolean{
            var netstate = false
            val connectivity = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
            val info = connectivity.allNetworkInfo
            for (i in info.indices) {
                if (info[i].state == NetworkInfo.State.CONNECTED) {
                    netstate = true
                    break
                }
            }
            return netstate
        }

    }

}